money =5000000
name=input("请输入您的姓名")
def check(s):
    if s:
        print("----------查询余额----------")
    print(f"{name}您的余额为{money}元")

def save(num):
    global money
    money+=num
    print("----------存款----------")
    print(f"{name},您存款{num}元成功")
    check(False)
    return money

def fetch(num):
    global money
    money -= num
    print("----------取款----------")
    print(f"{name},您取款{num}元成功")
    check(False)
    return money

def main():
    print("-----------主菜单----------")
    print(f"{name},欢迎来到ATM,请选择操作")
    print("查询余额\t\t[输入1]")
    print("存款\t\t[输入2]")
    print("取款\t\t[输入3]")
    print("退出\t\t[输入4]")
    return input("请输入您的请求")

while True:
    num=main()
    if(num=="1"):
        check(True)
        continue
    elif(num=="2"):
        n=int(input("请输入您要存款的金额"))
        save(n)
        continue
    elif(num=="3"):
        n=int(input("请输入您要取款的金额"))
        fetch(n)
        continue
    else:
        break


